<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/include/page.jsp"%>
<jsp:useBean class="com.wangsh.train.cla.pojo.AClass" id="pojo"/>
<!DOCTYPE HTML>
<html>
	<head>
		<%@ include file="/common/include/title.jsp"%>
		<title>添加班级 - 培训机构</title>
	</head>
	<body>
		<article class="page-container">
			<form class="form form-horizontal" id="formSubmit" action="${rootPath }/back/class/classInsertSubmit.htm">
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span
						class="c-red">*</span>分类：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="hidden" name="cateId" id="cateId" value="${clas.cateId}">
						<br/>
						<span>
							<select id="cate1" class="custom-select" onchange="return selectCate('cate1','cate2','cateId','false');">
								<option value="0">请选择</option>
							</select>
							<select id="cate2" class="custom-select" onchange="return selectCate('cate2','cate3','cateId','false');">
							</select>
							<select id="cate3" class="custom-select" onchange="return selectCate('cate3','cate4','cateId','false');">
							</select>
						</span>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span
						class="c-red">*</span>名称：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="" placeholder="请输入名称"
							id="name" name="name">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span
						class="c-red">*</span>地区：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="hidden" name="regionId" id="regionId" value="${clas.regionId}">
						<span>
							<select id="region1" class="custom-select" onchange="return selectRegion('region1','region2','regionId','false');">
								<option value="0">请选择</option>
							</select>
							<select id="region2" class="custom-select" onchange="return selectRegion('region2','region3','regionId','false');">
							</select>
							<select id="region3" class="custom-select" onchange="return selectRegion('region3','region4','regionId','false');">
							</select>
							<select id="region4" class="custom-select" onchange="return selectRegion('region4','region5','regionId','false');">
							</select>
							<select id="region5" class="custom-select" onchange="return selectRegion('region5','region6','regionId','false');">
							</select>
							<select id="region6" class="custom-select" onchange="return selectRegion('region6','region7','regionId','false');">
							</select>
						</span>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">地址：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="" placeholder="请输入地址"
							id="address" name="address">
					</div>
				</div>
				<!-- <div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span
						class="c-red">*</span>分类栏目：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<span class="select-box"> <select name="articlecolumn"
							class="select">
								<option value="0">全部栏目</option>
								<option value="1">新闻资讯</option>
								<option value="11">├行业动态</option>
								<option value="12">├行业资讯</option>
								<option value="13">├行业新闻</option>
						</select>
						</span>
					</div>
				</div> -->
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">开班时间：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" name="stTimeStr" value="<fmt:formatDate value="${sys_now }" pattern="yyyy-MM-dd HH:mm:ss"/>" 
							onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"
							id="logmin" readonly="readonly" class="input-text Wdate" style="width: 160px;">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">结束时间：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" name="edTimeStr" value="<fmt:formatDate value="${sys_now }" pattern="yyyy-MM-dd HH:mm:ss"/>" 
							onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"
							id="logmin" readonly="readonly" class="input-text Wdate" style="width: 160px;">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">发布时间：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" readonly="readonly" value="<fmt:formatDate value="${sys_now }" pattern="yyyy-MM-dd HH:mm:ss"/>"
							onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"
							id="pubTimeStr" name="pubTimeStr" class="input-text Wdate" style="width: 160px;">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">班级状态：</label>
					<div class="formControls col-xs-8 col-sm-9 skin-minimal">
						<c:set value="1" var="currCount"/>
						<c:forEach items="${pojo.enumsMap }" var="me" varStatus="stat">
							<c:if test="${fn:startsWith(me.key,'ClASTATUS')}">
								<!-- 拆分,按照-拆分,取最后一个 -->
								<c:set value="${fn:split(me.key, '-')}" var="keys"/>
								<div class="radio-box">
									<label for="${me.key }">
										<input type="radio" id="${me.key }" name="claStatus" value="${keys[1] }" ${currCount == 1 ? 'checked' : '' }>
										&nbsp;${me.value }
									</label>
								</div>
								<c:set value="${currCount + 1 }" var="currCount"/>
							</c:if>
						</c:forEach>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">状态：</label>
					<div class="formControls col-xs-8 col-sm-9 skin-minimal">
						<c:set value="1" var="currCount"/>
						<c:forEach items="${pojo.enumsMap }" var="me" varStatus="stat">
							<c:if test="${fn:startsWith(me.key,'STATUS')}">
								<!-- 拆分,按照-拆分,取最后一个 -->
								<c:set value="${fn:split(me.key, '-')}" var="keys"/>
								<div class="radio-box">
									<label for="${me.key }">
										<input type="radio" id="${me.key }" name="status" value="${keys[1] }" ${currCount == 1 ? 'checked' : '' }>
										&nbsp;${me.value }
									</label>
								</div>
								<c:set value="${currCount + 1 }" var="currCount"/>
							</c:if>
						</c:forEach>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">内容：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<script name="content" id="editor" type="text/plain"
							style="width: 100%; height: 200px;"></script>
					</div>
				</div>
				<div class="row cl">
					<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
						<button 
							class="btn btn-primary radius" type="submit">
							<i class="Hui-iconfont">&#xe632;</i> 保存
						</button>
					</div>
				</div>
			</form>
		</article>
		<%@ include file="/common/include/footer.jsp" %>
		<script type="text/javascript">
			$(function(){
				$('.skin-minimal input').iCheck({
					checkboxClass: 'icheckbox-blue',
					radioClass: 'iradio-blue',
					increaseArea: '20%'
				});
				
				//表单验证
				$("#formSubmit").validate({
					rules:{
						name:{
							required:true,
						},
						capital:{
							required:true,
						},
						stYear:{
							required:true,
						},
						edYear:{
							required:true,
						}
			
					},
					onkeyup:false,
					focusCleanup:true,
					success:"valid",
					submitHandler:function(form){
						$(form).ajaxSubmit({
							type: 'post',
							success: function(data){
								/* 弹出框 */
								layer.msg(data.info,{icon:1,time:3000},function()
								{
									if(data.code == '0')
									{
										var index = parent.layer.getFrameIndex(window.name);
										parent.$('.btn-refresh').click();
										parent.layer.close(index);
									}
								});
							},
							dataType:"json"
						});
					}
				});
				/* 初始化百度编辑器 */
				var ue = UE.getEditor('editor');
				
				/* 查询一级节点 */
				selectRegion('region1','region1','regionId','true');
			  	
			  	selectCate('cate1','cate1','cateId','true')
			});
		</script>
	</body>
</html>